package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ArtworkMapper;
import com.ruoyi.system.domain.Artwork;
import com.ruoyi.system.service.IArtworkService;

/**
 * 作品Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-20
 */
@Service
public class ArtworkServiceImpl implements IArtworkService 
{
    @Autowired
    private ArtworkMapper artworkMapper;

    /**
     * 查询作品
     * 
     * @param id 作品主键
     * @return 作品
     */
    @Override
    public Artwork selectArtworkById(Long id)
    {
        return artworkMapper.selectArtworkById(id);
    }

    /**
     * 查询作品列表
     * 
     * @param artwork 作品
     * @return 作品
     */
    @Override
    public List<Artwork> selectArtworkList(Artwork artwork)
    {
        return artworkMapper.selectArtworkList(artwork);
    }

    /**
     * 新增作品
     * 
     * @param artwork 作品
     * @return 结果
     */
    @Override
    public int insertArtwork(Artwork artwork)
    {
        artwork.setCreateTime(DateUtils.getNowDate());
        return artworkMapper.insertArtwork(artwork);
    }

    /**
     * 修改作品
     * 
     * @param artwork 作品
     * @return 结果
     */
    @Override
    public int updateArtwork(Artwork artwork)
    {
        artwork.setUpdateTime(DateUtils.getNowDate());
        return artworkMapper.updateArtwork(artwork);
    }

    /**
     * 批量删除作品
     * 
     * @param ids 需要删除的作品主键
     * @return 结果
     */
    @Override
    public int deleteArtworkByIds(Long[] ids)
    {
        return artworkMapper.deleteArtworkByIds(ids);
    }

    /**
     * 删除作品信息
     * 
     * @param id 作品主键
     * @return 结果
     */
    @Override
    public int deleteArtworkById(Long id)
    {
        return artworkMapper.deleteArtworkById(id);
    }
}
